package WaiBao;

import java.util.Arrays;

public class GuoJiaXin {
    public static void main(String[] args) {
        String[] name = {"季苍明(班长)", "季昌明(副班长)", "小李(学习委员)", "赵丽村(文艺委员)", "赵立春", "赵文强", "赵怀安", "高小琴", "张三水", "张光那", "李光明", "李文强",
                "李帅帅", "张晓鹏", "沙瑞金", "陈德顺", "陈即可", "晨晨", "张淮安", "周星驰", "刘德华", "刘萌萌", "张海海", "张子云", "李晓朋", "刘大个", "李涵", "李子园",
                "安慕希", "郭嘉欣(学生)"};//考生本人:郭嘉欣(学生)
        int[] age = {21, 19, 19, 21, 22, 22, 21, 22, 19, 20, 19, 19, 20, 19, 21, 20, 20, 19, 20, 19, 19, 21, 21, 21, 20, 21, 18, 18, 22, 20};//考生年龄：20岁

        double[] lianxi1 = {78, 86, 84, 79, 77, 74, 75, 65, 73, 81, 68, 72, 71, 78, 69, 70, 62, 80, 86, 58, 92, 87, 95, 88, 75, 70, 74, 72, 84, 95};
        double[] lianxi2 = {89, 74, 75, 71, 82, 77, 73, 85, 70, 78, 85, 95, 85, 74, 87, 74, 74, 79, 64, 55, 97, 71, 86, 81, 88, 85, 81, 86, 88, 95};
        double[] lianxi3 = {84, 84, 94, 83, 71, 61, 78, 80, 84, 60, 63, 81, 75, 75, 95, 68, 69, 69, 96, 93, 92, 81, 95, 75, 79, 84, 77, 61, 90, 96};

        double guanzi1;//代表每个学生的总分
        double guanzi2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            guanzi1 = lianxi1[i] +lianxi2[i] +lianxi3[i];
//            guanzi2 = ( guanzi1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +guanzi1);
//            System.out.println(name[i] + "的平均分为:" +guanzi2);
//        }


        double jainpan1 = 0,jainpan2 = 0;
        double[] heihei = new double[30];
//        for (int i = 0; i < 30; i++) {
//            jainpan1 = lianxi1[i] +lianxi2[i] + lianxi3[i];
//            jainpan2= (jainpan1 * 1.0) / 3;
//            heihei[i] = jainpan2;
//        }
//
//        for (int i = 0; i <heihei.length - 1; i++) {
//            for (int j = 0; j < heihei.length - i - 1; j++) {
//                if (heihei[j] < heihei [j + 1]) {
//                    double tep =heihei[j];
//                    heihei[j] =heihei[j + 1];
//                    heihei[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(heihei[i]);
//        }


        double daer1 = 0, daer2 = 0, daer3 = 0;//计算每门课的平均分
        double meiyou1 = 0,meiyou2 = 0, meiyou3 = 0;//计算每门课标准差
        double larou1 = 0,larou2 = 0,larou3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <lianxi1.length; i++) {
            sum2+=lianxi1[i];
        }
        daer1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ daer1);
        double Sum = 0;
        for (int i = 0; i <lianxi2.length; i++) {
            Sum+=lianxi2[i];
        }
        daer2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ daer2);
        double sum = 0;
        for (int i = 0; i <lianxi3.length; i++) {
            sum+=lianxi3[i];
        }
        daer3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+  daer3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < lianxi1.length; i++) {
            c1+= (lianxi1[i] - daer1)*(lianxi1[i] - daer1);
        }
        meiyou1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+meiyou1);

        for (int i = 0; i <lianxi2.length; i++) {
            c2+= (lianxi2[i] - daer2)*(lianxi2[i] -  daer2);
        }
        meiyou2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+meiyou2);

        for (int i = 0; i < lianxi3.length; i++) {
            c3+= (lianxi3[i] - daer3)*(lianxi3[i] - daer3);
        }
        meiyou3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+meiyou3);
////////
////////
        Arrays.sort(lianxi1);
        Arrays.sort(lianxi2);
        Arrays.sort(lianxi3);
        larou1 =(lianxi1[14]+lianxi1[15])*1.0/2;
        larou2 =(lianxi2[14]+lianxi2[15])*1.0/2;
        larou3 =(lianxi3[14]+lianxi3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+larou1);
        System.out.println("微生物学的中位数为:"+larou2);
        System.out.println("人体组织解剖学的中位数为:"+larou3);




    }
}
